execute unless function vs:system/game_ctrol/guard_tower/place_test/can_place run return run tag @s add no_consume

place template vs:guard_tower

tag @s add placer

#main
execute align xyz positioned ~1.5 ~6.2 ~1.5 summon item_display at @s run function vs:system/game_ctrol/guard_tower/place_data/main

#HitBox
execute align xyz positioned ~1.5 ~4.2 ~1.5 summon giant at @s run function vs:system/game_ctrol/guard_tower/place_data/hit_box

#healthDisplay
execute align xyz positioned ~1.5 ~7 ~1.5 summon text_display at @s run function vs:system/game_ctrol/guard_tower/place_data/health_display

#powerDisplay
execute align xyz positioned ~1.5 ~1.75 ~0.98 summon text_display at @s run function vs:system/game_ctrol/guard_tower/place_data/power_display

#BatteryPowerDisplay
execute align xyz positioned ~1.5 ~0.95 ~0.98 summon text_display at @s run function vs:system/game_ctrol/guard_tower/place_data/battery_power_display

#powerItemDisplay
execute align xyz positioned ~1.5 ~1.5 ~0.98 summon item_display at @s run function vs:system/game_ctrol/guard_tower/place_data/power_item_display

#powerInputInteraction
execute align xyz positioned ~1.5 ~1.25 ~1.2 summon interaction at @s run function vs:system/game_ctrol/guard_tower/place_data/power_input_interaction

#run
execute as @n[tag=main,distance=..10,type=minecraft:item_display] at @s run function vs:system/game_ctrol/guard_tower/disable
execute as @n[tag=temp.powerID,distance=..10,type=item_display] at @s run function vs:system/game_ctrol/guard_tower/power/item_display/empty

tag @s remove placer
tag @n[tag=main,distance=..10,type=item_display] remove main
tag @n[tag=temp.powerID,distance=..10,type=item_display] remove temp.powerID

execute align xz run tp @s ~0.5 ~ ~0.5